package com.tedu.bill.demo2;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * Author：毕龙
 * Date: 2024/5/26 15:16
 */
public class TestInputStream1 {
    public static void main(String[] args) throws IOException {
        //创建file对象
        File file = new File("day14/src/a.txt");

        //创建输入流对象
        FileInputStream fis = new FileInputStream(file);

        //获取文件中的字节
        //int read = fis.read();
        byte[] bytes = new byte[10];
        int len = bytes.length ;
        while ((len = fis.read(bytes,0, len))!=-1){
            String s = new String(bytes,0,len,"utf-8");
            System.out.print(s);
        }

        //释放资源
        fis.close();
    }
}
